package com.aaa.statistics.controller.api;


import com.aaa.entity.CheckItem;
import com.aaa.entity.DictData;
import com.aaa.entity.HisCheckResult;
import com.aaa.statistics.service.CheckService;
import com.aaa.statistics.vo.HisCheckResultSaleVo;
import com.aaa.statistics.vo.HisCheckResultVo;
import com.aaa.vo.Result;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author ：晋升（js20020923@qq.com）
 * @date ：Created in 2023/3/29 11:39
 * @description：查询项目销售
 * @modified By：
 * @version:
 */
@RestController
@RequestMapping("statistics/api/check")
public class ApiCheckController {
    @Autowired
    private CheckService checkService;

    /**
     * 初始化检查项目
     */
    @GetMapping("/queryList")
    public Result<List<CheckItem>> queryList(){
        return checkService.queryList();
    }

    /**
     * 通过字典类型查询对应的检查状态
     * @param type
     * @return
     */
    @GetMapping("/fingBytype/{type}")
    public Result<List<DictData>> fingBytype(@PathVariable String type){
        System.out.println("==============="+type);
        return checkService.fingBytype(type);
    }

    @PostMapping("/list/{currentPage}/{pageSize}")
    public Result<IPage<HisCheckResult>> list(
            @PathVariable Integer currentPage,
            @PathVariable Integer pageSize,
            @RequestBody HisCheckResultVo hisCheckResultVo
    ){
        System.out.println("================="+hisCheckResultVo);
        return checkService.HisetByPage(currentPage,pageSize,hisCheckResultVo);
    }
    @PostMapping("/liststat")
    public Result<List<HisCheckResultSaleVo>> listStat(
            @RequestBody HisCheckResultVo hisCheckResultVo
    ){
        System.out.println("================="+hisCheckResultVo);
        return checkService.listStat(hisCheckResultVo);
    }

}

